package com.example.demobean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
public class Student {
    private String name;
    @Autowired
    private Body body;

    public Student() {
        System.out.println("student is created.");
    }

    public void show(){
        System.out.println("show youself");
        body.move();//没有@Autowired将会报错 java.lang.NullPointerException
    }

}
